<?php
session_start();

function __autoload($file) {
    include_once "core/". $file.".php";
}


$calc = new BaseCalc();

if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (isset($_POST['numb'])) {
        $calc->calculate($_SESSION['calc'],(int) $_POST['numb']);
    } elseif (isset($_POST['operation']) && $_POST['operation'] != "Back") {
        $calc->calculate($_SESSION['calc'],$_POST['operation']);
    }
}

$showCalc = new ShowCalcNumber();
$showCalcO = new ShowCalcOperations($calc->getOperations());
$txt = 0;
if (isset($_SESSION['calc'])) {
    $txt = (isset($_SESSION['calc']['numb'])) ? $_SESSION['calc']['numb'] : "";
    $txt .= (isset($_SESSION['calc']['oper'])) ? $_SESSION['calc']['oper'] : "";
    $txt .= (isset($_SESSION['calc']['numb2'])) ? $_SESSION['calc']['numb2'] : "";

}
